const express = require('express')

const router=express.Router()

// 验证规则中间件
const expressJoi=require('@escook/express-joi')

// 引入验证规则
const {add_cate_schema,delete_cate_schema,get_cate_schema,update_cate_schema} =require ('../schema/artcate')

// 导入文章分类的路由处理函数模块
const artcate_handler = require('../router_handler/artcate')

// 获取文章列表
router.get('/cates',artcate_handler.getArticleCates)

// 新增文章分类
router.post('/addcates',expressJoi(add_cate_schema),artcate_handler.addArticleCates)


// 根据id删除文章
router.get('/deletecate/:id',expressJoi(delete_cate_schema),artcate_handler.deleteCateById)


// 根据id获取文章
router.get('/getArticleById/:id',expressJoi(get_cate_schema),artcate_handler.getArticleById)


// 根据id更新文章
router.post('/updatecate',expressJoi(update_cate_schema),artcate_handler.updateCateById)

module.exports=router